// 跳转合同路由
import { PageRoutesTypeEnum } from 'pub-bbx-global/pageType/dist/enum/PageRoutesEnum';
import { openAccurateTab } from '@src/util/platform';

// 跳转产品详情
export function jumpProductDetail({ productId }) {
  let fromId = window.frameElement.getAttribute('id');
  openAccurateTab({
    type: PageRoutesTypeEnum.PageProductView,
    key: productId,
    params: 'noHistory=1',
    fromId,
  });
}

// 跳转客户详情
export function jumpCustomerDetail({ customerId }) {
  let fromId = window.frameElement.getAttribute('id');

  openAccurateTab({
    type: PageRoutesTypeEnum.PageCustomerView,
    key: customerId,
    params: 'noHistory=1',
    fromId,
  });
}

// 跳转产品类型
export function jumpProductType({ catalogId }) {
  let fromId = window.frameElement.getAttribute('id');

  openAccurateTab({
    type: PageRoutesTypeEnum.PageProductV2CatalogView,
    key: catalogId,
    params: `id=${catalogId}`,
    fromId,
  });
}

// 跳转产品模板
export function jumpProductTemplate({ productTemplateId }) {
  let fromId = window.frameElement.getAttribute('id');

  openAccurateTab({
    type: PageRoutesTypeEnum.PageProductTemplate,
    key: productTemplateId,
    params: 'noHistory=1',
    fromId,
  });
}
